/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package unc.pds.facets;

import unc.pds.model.UserRemote;

/**
 *
 * @author Михаил
 */
public class ShortFriendsFacet implements Facet {
    public static final int DISPLAY_COUNT = 10;
    public ShortFriendsFacet(UserRemote user) {
        this.user = user;
    }
    UserRemote user;
    public String draw() throws Exception {
        String result = "";
        UserRemote[] friends = user.getFriends();
        result += "<h4>Друзья:</h4>";
        int count = Math.min(friends.length, 10);
        for (int i=0; i<count; i++) {
            result += "<p><a href = \"index.jsp?id="+ friends[i].getKey() +"&view=posts\">"+ friends[i].getNickname() +"</a></p>\n";
        }
        result += "<p><a href=\"index.jsp?id="+ user.getKey() +"&view=friends\">Больше...</a></p>";
        return result;
    }
    public boolean isSide() {
        return true;
    }
}
